<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" id = "app">
    <script>
         var arr = [{
                name: "李四",
                id: "1001"
            },
            {
                name: "李二",
                id: "1002"
            },
            {
                name: "李三",
                id: "1003"
            },
            {
                name: "李五",
                id: "1004"
            }
        ]
        var app = document.getElementById("app");
        app.onkeydown = function(k){
            if(k.keyCode==13){
                var key = Number(this.value);
                var res = arr.findIndex(item=>{
                    return item.id == key;
                })
                if(res!=-1){
                    arr.splice(res,1)
                }
                console.log(arr);
                this.value = '';
            }
        }
        </script>
</body>
</html>